package com.woniu.adminservice.dao;

import com.woniu.adminservice.entity.Roles;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RolesDao {
    Roles queryById(Integer id);

    List<Roles> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);
    
    List<Roles> findAll();

    List<Roles> queryAll(Roles roles);

    int insert(Roles roles);

    int update(Roles roles);

    int deleteById(Integer id);

    @Select("select * from roles left join users_role on users_role.role_id = roles.id where user_id=#{userid}")
    List<Roles> selectRolesByUserId(Integer userid);

    @Select("select * from roles")
    List<Roles> selectAllByPage(@Param("currentPage") Integer currentPage,@Param("pageSize") Integer pageSize);

    @Select("select * from roles where role_name = #{value}")
    Roles findByRoleName(String roleName);

    void deleteByIds(List roleIds);

    @Select("select * from roles where id =#{value} ")
    Roles selectRolesById(Integer id);

}